{% load static %}
<!doctype html>
<html>
<head>
    <script type="text/javascript" src="{% static "codemirror/lib/codemirror.js" %}"></script>
    <link rel="stylesheet" href="{% static "codemirror/lib/codemirror.css" %}">
    <script type="text/javascript" src="{% static "codemirror/mode/python.js" %}"></script>
</head>
<body>
    <form method="POST" action="">{% csrf_token %}
        {{ form }}
    </form>

    {{ form.media }}

    <h3>codemirror</h3>
    <textarea id="ta" style="margin: 0px; width: 430px; height: 268px;" >class xx(object):</textarea>

    <script type="text/javascript">
    var editor = CodeMirror.fromTextArea(document.getElementById("ta"), {
            mode: {name: "python",
                   version: 3,
                   singleLineStringErrors: false},
            lineNumbers: true,
            indentUnit: 4,
            matchBrackets: true
        });
    </script>
</body>